package com.jxc.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class Simple extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = req.getParameter("name");
        String id = req.getParameter("id");
        String sex = req.getParameter("sex");
        String[] specs = req.getParameterValues("spec");
        PrintWriter out = resp.getWriter();
        out.print("<h1>name: "+name+"</h1><br>");
        out.print("<h1>id: "+id+"</h1><br>");
        out.print("<h1>sex: "+sex+"</h1><br>");
        out.print("<h1>id: "+id+"</h1><br>");
        for (int i = 0;i<specs.length;i++){
            out.print("<h1>spec: "+specs[i]+"</h1><br>");
        }
    }
}
